import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// until -- 工具
import utils from './utils'
import SNUI from './components'

// scss
import '@scss/reset.scss'

Vue.use(utils)
Vue.use(SNUI)

Vue.config.productionTip = false

// make sure to set this synchronously immediately after loading Vue
if (process.env.NODE_ENV === 'development') {
  Vue.config.devtools = true
}

/* 判断登录状态和vip状态 */
const proto = Vue.prototype
const token = proto.$cookie.getCookie('token')
const isLogin = !proto.$_.isEmpty(token)

// 全局同步登录状态和当前VIP状态
store.dispatch('TOGGLE_USER_ISLOGIN', isLogin)
store.dispatch('TOGGLE_USER_ID', token)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#wrapper')
